/**验证银行秘密，只能输入三次
 * @author yuisama
 * @date 2022/03/21 17:08
 **/
import java.util.Scanner;
public class KeyWord {
    public static void main(String[] args) {
        String password = "456315";
        System.out.println("请输入密码");
        int count = 0;
        //最多只能输入三次
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            String str = scanner.next();
            if (count == 3) {
                //先判断次数
                System.out.println("超过次数，银行卡已冻结");
                break;
            }
            if (str.equals(password)) {
                //引用数据类型比较是否相等，统一用equals，包括字符串
                System.out.println("密码正确，欢迎登陆");
                break;
            } else {
                System.out.println("密码错误，请重新输入");
                count++;
            }
        }
    }
}
